import QtQuick
import QtQuick.Controls

Rectangle {
    width: 400
    height: 300
    color: "lightgray"

    Button {
        text: "设置菜单"
        anchors.centerIn: parent
        onClicked: settingsMenu.popup()
    }

    Menu {
        id: settingsMenu
        title: "设置"

        Action {
            id: autoSaveAction
            text: "自动保存"
            checkable: true
            checked: false
            onTriggered: {
                console.log("自动保存:", checked)
            }
        }

        Menu {
            title: "主题"
            MenuItem {
                text: "浅色"
                checkable: true
                checked: true
                ButtonGroup.group: themeGroup
            }
            MenuItem {
                text: "深色"
                checkable: true
                ButtonGroup.group: themeGroup
            }
        }
    }

    ButtonGroup {
        id: themeGroup
    }
}
